package com.core;

import java.util.HashSet;
import java.util.Iterator;


public class URLStringBuilder
        extends HashSet <String> {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;



    @Override
    public String toString () {

        StringBuilder stringBuilder = new StringBuilder();
        boolean needAmp = false;
        Iterator <String> iterator = this.iterator();
        while ( iterator.hasNext() ) {
            String param = iterator.next();

            if ( needAmp ) {

                stringBuilder.append(String.format("&%s", param));
            } else {
                stringBuilder.append(String.format("%s", param));
                needAmp = true;
            }
        }

        return stringBuilder.toString();
    }


}
